﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace HPIT_Library
{
    public partial class inbound : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                GridView1.DataSource = HPIT_Library_BLL.BorrowBooksManger.Select();
                GridView1.DataBind();
            }
        }

        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            var id = Convert.ToInt32(e.CommandArgument);
            var name = e.CommandName;
            if (name == "Button_update")
            {
                var num = HPIT_Library_BLL.BorrowBooksManger.Update(id);
                if (num > 0)
                {
                    Response.Write("<script>alert('更改成功')</script>");
                    GridView1.DataSource = HPIT_Library_BLL.BorrowBooksManger.Select();
                    GridView1.DataBind();
                }
                else
                {
                    Response.Write("<script>alert('更改失败')</script>");
                }
            }
            
        }

        
    }
}